using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Zhaoxi.Zhihu.Infrastructure;
using Zhaoxi.Zhihu.UseCases.Common.Interface;

namespace TestProject1;

public abstract class Testbase
{
    public ISender Sender { get;private set; }
    
    public IUser CurrentUser { get;private set; }
    
    public AppDbContext DbContext { get;private set; }

    protected Testbase(IServiceProvider serviceProvider)
    {
        serviceProvider.GetRequiredService<DbInitializer>().InitialCreate();
        Sender = serviceProvider.GetRequiredService<ISender>();
        CurrentUser= serviceProvider.GetRequiredService<IUser>();
        DbContext = serviceProvider.GetRequiredService<AppDbContext>();
    }
}